class Solution {
public:
    int distanceBetweenBusStops(vector<int>& distance, int start, int destination) {
        int pos = start, order = 0, reverse = 0;
        while (pos != destination)
        {
            order += distance[pos];
            pos = (pos + 1) % distance.size();
        }
        pos = destination;
        while (pos != start)
        {
            reverse += distance[pos];
            pos = (pos + 1) % distance.size();
        }
        return min(order, reverse);
    }
}; class Solution {
public:
    int distanceBetweenBusStops(vector<int>& distance, int start, int destination) {
        int pos = start, order = 0, reverse = 0;
        while (pos != destination)
        {
            order += distance[pos];
            pos = (pos + 1) % distance.size();
        }
        pos = destination;
        while (pos != start)
        {
            reverse += distance[pos];
            pos = (pos + 1) % distance.size();
        }
        return min(order, reverse);
    }
};